<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    {{-- <meta http-equiv="Access-Control-Allow-Origin" content="*"> --}}
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <title>测试</title>
    <link rel="stylesheet" href="{{ asset('admin/frame/layui/css/layui.css') }}">
    <link rel="stylesheet" href="{{ asset('admin/frame/static/css/style.css') }}">
    <link rel="icon" href="{{ asset('admin/frame/static/image/code.png') }}">
</head>
<body class=" body">
<div>
    <button class="layui-btn order">创建订单</button>
    <button class="layui-btn recharge">充值记录</button>
    <button class="layui-btn valid_active">充值记录</button>
</div>
<script src="{{ asset('admin/frame/layui/layui.js') }}"></script>
<script src="{{ asset('js/jquery/jquery-2.1.0.min.js') }}"></script>
<script src="{{ asset('js/global.js') }}"></script>
<script src="{{ asset('js/jquery.form.js') }}"></script>
<script type="text/javascript">
    layui.use(['form', 'layer'], function () {
        // 操作对象
        var form = layui.form, layer = layui.layer, $ = layui.jquery;

        $('.order').on('click', function(){
            $.ajax({
                url: '{{ route('iapppay.order') }}',
                data: {goods_id : 2, gamer_id : '127865'},
                type: 'POST',
                dataType: 'json',
                success: function(data){
                    console.log(data);
                }
            });
        })

        $('.recharge').on('click', function(){
            $.ajax({
                url: '{{ route('test.recharge') }}',
                data: {},
                type: 'GET',
                dataType: 'json',
                success: function(data){
                    console.log(data);
                }
            });
        })
        $('.valid_active').on('click', function() {
            window.location.href = '{{ route('test.validActive') }}'
        })

        // 提交监听
        form.on('submit(sub)', function (data) {
            var url = $(this).attr('data-url');
            commonAjaxSubmit(url, 'POST');
        });

    });
</script>
</body>
</html>